#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
    int n = 0;
    scanf("%d", &n);
    int a[10][10] = { 0 };
    int i = 0, j = 0, l = 0,r = 0, b = 0, x = 0;
    int z = n - 1;
    while (i <= z)
    {
        for (j = i; j <=z; j++)
        {
            a[i][j] = ++b;
        }
        for (r = i + 1; r <=z; r++)
        {
            a[r][z] = ++b;
        }
        for (l = z-1; l >=i; l--)
        {
            a[z][l] = ++b;
        }
        for (x = z-1; x >i; x--)
        {
            a[x][i] = ++b;
        }
        i++;
        z--;
    }
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < n; j++)
        {
            printf("%3d", a[i][j]);
        }
        printf("\n");
    }
    return 0;
}